import dayjs from "dayjs";
//处理时间
export function formattime(s: string): string {
  return dayjs(s).format("YYYY-MM-DD HH:mm:ss");
}
//防抖
export function debounce(callback: () => void) {
  let timer: NodeJS.Timeout | null = null;
  return function () {
    if (timer) {
      clearTimeout(timer);
      timer = null;
    }
    timer = setTimeout(() => {
      callback();
      timer = null;
    }, 500);
  };
}
